import http from '@/http';
import type {CommentParams, ResponseData} from '@/types/interface';

const commentApi = {
    // 发布评论
    publishComment: (data: CommentParams): Promise<ResponseData<{ commentId: number }>> => {
        return http.post('/comment/publish', data);
    },

    // 获取楼层下的评论列表
    getFloorComments: (floorId: number, page: number, size: number): Promise<ResponseData<{
        list: Comment[];
        total: number;
    }>> => {
        return http.get(`/comment/list?floorId=${floorId}&page=${page}&size=${size}`);
    },

    // 删除评论
    deleteComment: (commentId: number): Promise<ResponseData<boolean>> => {
        return http.delete(`/comment/delete?commentId=${commentId}`);
    }
};

export default commentApi;